Make a pot generating command available
authorMatthias Clasen <mclasen@redhat.com>
Tue, 3 Mar 2015 12:11:41 +0000 (07:11 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 3 Mar 2015 12:22:41 +0000 (07:22 -0500)
Translators don't want to run autogen before generating pot,
so give them a script.

Makefile.am
make-pot [new file with mode: 0755]
po-properties/Makefile.in.in
po/Makefile.in.in

index 2b72ff93b2226a47ac017e1ed5bcc7e3599751a9..a4c56a770127c0ec3e8dbc964e0759d249c1620d 100644 (file)
@@ -21,7 +21,8 @@ EXTRA_DIST +=                 \
        gtk-zip.sh.in           \
        sanitize-la.sh          \
        po/README.translators   \
-       po/po2tbl.sed.in
+       po/po2tbl.sed.in        \
+       make-pot
 
 MAINTAINERCLEANFILES = \
        $(GITIGNORE_MAINTAINERCLEANFILES_TOPLEVEL) \
diff --git a/make-pot b/make-pot
new file mode 100755 (executable)
index 0000000..279cfaa
--- /dev/null
+++ b/make-pot
@@ -0,0 +1,61 @@
+#! /bin/bash
+
+# This script extracts the typical xgettext invokation out of
+# po/Makefile.in.in, in order for it to be available as a shell
+# command without the need to autogen first. This is needed for
+# translation tools such as the damn lies website.
+#
+# Call this from your GTK+ checkout directory, like this:
+#
+#   ./make-pot
+#
+# to generate po/gtk30.pot, and like this:
+#
+#   ./make-pot properties
+#
+# to generate po-properties/gtk30-properties.pot.
+
+
+XGETTEXT="${XGETTEXT:-xgettext}"
+top_srcdir="${top_srcdir:-.}"
+
+if test "$1" = "properties"; then
+  srcdir="${srcdir:-$top_srcdir/po-properties}"
+  GETTEXT_PACKAGE="${GETTEXT_PACKAGE:-gtk30-properties}"
+  XGETTEXT_KEYWORDS="${XGETTEXT_KEYWORDS:- --keyword --keyword=P_ }"
+else
+  srcdir="${srcdir:-$top_srcdir/po}"
+  GETTEXT_PACKAGE="${GETTEXT_PACKAGE:-gtk30}"
+  XGETTEXT_KEYWORDS="${XGETTEXT_KEYWORDS:- --keyword=_ --keyword=N_ --keyword=C_:1c,2 --keyword=NC_:1c,2 --keyword=g_dngettext:2,3 }"
+fi
+
+$XGETTEXT --default-domain="$GETTEXT_PACKAGE" \
+          --directory="$top_srcdir" \
+          --add-comments \
+          $XGETTEXT_KEYWORDS \
+          --from-code=utf-8 \
+          --flag=g_dngettext:2:pass-c-format \
+          --flag=g_strdup_printf:1:c-format \
+          --flag=g_string_printf:2:c-format \
+          --flag=g_string_append_printf:2:c-format \
+          --flag=g_error_new:3:c-format \
+          --flag=g_set_error:4:c-format \
+          --flag=g_markup_printf_escaped:1:c-format \
+          --flag=g_log:3:c-format \
+          --flag=g_print:1:c-format \
+          --flag=g_printerr:1:c-format \
+          --flag=g_printf:1:c-format \
+          --flag=g_fprintf:2:c-format \
+          --flag=g_sprintf:2:c-format \
+          --flag=g_snprintf:3:c-format \
+          --flag=g_scanner_error:2:c-format \
+          --flag=g_scanner_warn:2:c-format \
+          --flag=gtk_message_dialog_format_secondary_markup:2:c-format \
+          --flag=gtk_message_dialog_format_secondary_text:2:c-format \
+          --flag=gtk_message_dialog_new:5:c-format \
+          --flag=gtk_message_dialog_new_with_markup:5:c-format \
+          --files-from="$srcdir/POTFILES.in" \
+        && test ! -f "$GETTEXT_PACKAGE.po" \
+           || ( rm -f "$srcdir/$GETTEXT_PACKAGE.pot" \
+                && mv "$GETTEXT_PACKAGE.po" "$srcdir/$GETTEXT_PACKAGE.pot" )
+
index 86571778f3290bfb82e8548d2631e68df7827be7..41b41df04ffacc4e25dd10dead7549ffd803d0f7 100644 (file)
@@ -95,13 +95,12 @@ all-yes: $(CATALOGS)
 all-no:
 
 $(srcdir)/$(GETTEXT_PACKAGE).pot: $(POTFILES)
-       $(XGETTEXT) --default-domain=$(GETTEXT_PACKAGE) --directory=$(top_srcdir) \
-         --add-comments --keyword --keyword=P_ \
-         --from-code=utf-8 \
-         --files-from=$(srcdir)/POTFILES.in \
-       && test ! -f $(GETTEXT_PACKAGE).po \
-          || ( rm -f $(srcdir)/$(GETTEXT_PACKAGE).pot \
-               && mv $(GETTEXT_PACKAGE).po $(srcdir)/$(GETTEXT_PACKAGE).pot )
+       XGETTEXT="$(XGETTEXT)" \
+       XGETTEXT_KEYWORDS=$(XGETTEXT_KEYWORDS)" \
+       GETTEXT_PACKAGE="$(GETTEXT_PACKAGE)" \
+       top_srcdir="$(top_srcdir)" \
+       srcdir="$(srcdir)" \
+       $(top_srcdir)/make-pot
 
 install: install-exec install-data
 install-exec:
index 9774e73b6f2c14fd18ecf87a5c60fd6da4cab47a..55bc85f4b146bac520194d981c811924155cc66e 100644 (file)
@@ -16,6 +16,8 @@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
 PACKAGE = @PACKAGE@
 VERSION = @VERSION@
 
+XGETTEXT_KEYWORDS= --keyword=_ --keyword=N_ --keyword=C_:1c,2 --keyword=NC_:1c,2 --keyword=g_dngettext:2,3
+
 SHELL = @SHELL@
 @SET_MAKE@
 
@@ -96,34 +98,12 @@ all-yes: $(CATALOGS)
 all-no:
 
 $(srcdir)/$(GETTEXT_PACKAGE).pot: $(POTFILES)
-       $(XGETTEXT) --default-domain=$(GETTEXT_PACKAGE) --directory=$(top_srcdir) \
-         --add-comments --keyword=_ --keyword=N_ --keyword=C_:1c,2 --keyword=NC_:1c,2 \
-         --from-code=utf-8 \
-         --keyword=g_dngettext:2,3 \
-         --flag=g_dngettext:2:pass-c-format \
-          --flag=g_strdup_printf:1:c-format \
-          --flag=g_string_printf:2:c-format \
-          --flag=g_string_append_printf:2:c-format \
-          --flag=g_error_new:3:c-format \
-          --flag=g_set_error:4:c-format \
-          --flag=g_markup_printf_escaped:1:c-format \
-          --flag=g_log:3:c-format \
-          --flag=g_print:1:c-format \
-          --flag=g_printerr:1:c-format \
-          --flag=g_printf:1:c-format \
-          --flag=g_fprintf:2:c-format \
-          --flag=g_sprintf:2:c-format \
-          --flag=g_snprintf:3:c-format \
-          --flag=g_scanner_error:2:c-format \
-          --flag=g_scanner_warn:2:c-format \
-          --flag=gtk_message_dialog_format_secondary_markup:2:c-format \
-          --flag=gtk_message_dialog_format_secondary_text:2:c-format \
-          --flag=gtk_message_dialog_new:5:c-format \
-          --flag=gtk_message_dialog_new_with_markup:5:c-format \
-         --files-from=$(srcdir)/POTFILES.in \
-       && test ! -f $(GETTEXT_PACKAGE).po \
-          || ( rm -f $(srcdir)/$(GETTEXT_PACKAGE).pot \
-               && mv $(GETTEXT_PACKAGE).po $(srcdir)/$(GETTEXT_PACKAGE).pot )
+       XGETTEXT="$(XGETTEXT)" \
+       XGETTEXT_KEYWORDS="$(XGETTEXT_KEYWORDS)" \
+       GETTEXT_PACKAGE="$(GETTEXT_PACKAGE)" \
+       top_srcdir="$(top_srcdir)" \
+       srcdir="$(srcdir)" \
+       $(top_srcdir)/make-pot
 
 install: install-exec install-data
 install-exec: